package com.isay.frameworklib.utils.auth;

import com.isay.frameworklib.utils.PreferencesUtils;

/**
 * Created by cywu4 on 2018/12/21.
 */
public class AuthUtils {

    private final static long ONE_DAT_TIME = 24 * 60 * 60 * 1000;

    private final static long AUTH_TIME = ONE_DAT_TIME * 30;

    public static boolean isAuth() {
        long time = System.currentTimeMillis();
        long installTime = PreferencesUtils.getLong("key_install_time", 0);
        if (installTime <= 0) {
            PreferencesUtils.put("key_install_time", time);
        } else if (time - installTime > AUTH_TIME) {
            return false;
        }
        return true;
    }

}
